<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml"> 
 
<head> 
	<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> 
	<title>湖南省自来水公司营销管理信息系统</title> 
	
	<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/text.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/form.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/buttons.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/grid.css" type="text/css" media="screen" title="no title" />	
	<link rel="stylesheet" href="../css/layout.css" type="text/css" media="screen" title="no title" />	
	
	<link rel="stylesheet" href="../css/ui-darkness/jquery-ui-1.8.12.custom.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/jquery.visualize.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/facebox.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/uniform.default.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/dataTables.css" type="text/css" media="screen" title="no title" />

	<link rel="stylesheet" href="../css/custom.css" type="text/css" media="screen" title="no title">

</head> 
 
<body> 

<div id="wrapper">
	
		
	<div id="bool"></div>
	
	<div id="content" class="xgrid">
		
 		
		<div class="x12">
			
			<h2>添加/修改员工信息</h2>
			
			<div class="form label-inline uniform">
	
				<div class="field"><label for="id">员工ID</label> <input id="id" name="fname" v-if="Syemp.id==''" size="50" type="text" class="medium" disabled="disabled" value="自动生成" /><input id="sid" name="fname" v-if="Syemp.id!=''" size="50" type="text" class="medium" disabled="disabled" v-model="Syemp.id" /></div>
				
				<div class="field"><label for="namde">员工工号</label> <input id="namde" v-model="Syemp.EmpNo" name="lname" size="50" type="text" class="medium" /></div>
				
				<div class="field"><label for="nasme">员工姓名</label> <input id="nasme" v-model="Syemp.EmpNmae" name="lname" size="50" type="text" class="medium" /></div>
				
				<div class="field"><label for="nfame">密码</label> <input id="nfame" v-model="Syemp.Pwd" name="lname" size="50" type="password" class="medium" /></div>
				
				<div class="field"><label for="type">所属部门</label> <select id="type" v-model="Syemp.DeptID" class="medium" >
                    <option >请选择</option>
                    <option v-for="de in SyDepts" :value="de.id"   :selected="de.id==Syemp.DeptID?'selected':''"  selected="selected">{{de.deptName}}</option>
                </select></div>
				<div class="field"><label for="description">备注</label> <textarea v-model="Syemp.Remark" rows="7" cols="50" id="description" name="description"></textarea></div>

				<div class="buttonrow">
                    <button class="btn" v-if="Syemp.id==''" @click="add()">保存</button>
                    <button class="btn" v-if="Syemp.id!=''" @click="update()">修改</button>
                    <button class="btn btn-grey" onClick="history.back(-1);">返回</button>
				</div>

			</div>
			
		</div> <!-- .x12 -->
		
	</div> <!-- #content -->
	
	<div id="footer">		
		<div class="content_pad">			
			<p>&copy; 2013-11 版权所有 <a href="#">湖南省自来水公司</a>.   技术支持 <a href="#">职业教育</a>.</p>
		</div> <!-- .content_pad -->
	</div> <!-- #footer -->
	
</div> <!-- #wrapper -->

<script src="../js/jquery/jquery-1.5.2.min.js"></script>
<script src="../js/jquery/jquery-ui-1.8.12.custom.min.js"></script>
<script src="../js/misc/excanvas.min.js"></script>
<script src="../js/jquery/facebox.js"></script>
<script src="../js/jquery/jquery.visualize.js"></script>
<script src="../js/jquery/jquery.dataTables.min.js"></script>
<script src="../js/jquery/jquery.tablesorter.min.js"></script>
<script src="../js/jquery/jquery.uniform.min.js"></script>
<script src="../js/jquery/jquery.placeholder.min.js"></script>

<script src="../js/widgets.js"></script>
<script src="../js/dashboard.js"></script>
<script src="../js/vue.js"></script>
<script type="text/javascript">
	

var app = new Vue({
    el:"#wrapper",
    data:{
        Syemp:{
            id:'',
            Pwd:'',
            Remark:'',
            EmpNo:'',
            EmpNmae:'',
            Disabled:'false',
            DeptID:''
        },
        SyDepts:'',
    },
    methods:{
        add(){
            $.getJSON("/Syemp/add",this.Syemp,function(json){
                if(json==1){
                    alert("添加成功");
                    location.href="sys_emp.html";
                }
            });
        },
        update(){
            $.getJSON("/Syemp/update",this.Syemp,function(json){
                if(json==1){
                    alert("修改成功");
                    location.href="sys_emp.html";
                }
            });
        }
    },
    watch:{
        Syemp:function(){
            this.$nextTick(function(){
                $(document).ready ( function ()
                {
                    Dashboard.init ();
                });
            });
        }
    },
    created(){
        $.getJSON("../Sydept/queryall",{},function(json){
            app.SyDepts=json;
        });
        var u = new URLSearchParams(location.search);
        var id = u.get("id");
        if(id!=null){
            $.getJSON("/Syemp/queryByid/"+id,{},function(json){
                app.Syemp.id=json.id;
                app.Syemp.DeptID=json.deptID;
                app.Syemp.Remark=json.remark;
                app.Syemp.Disabled=json.disabled;
                app.Syemp.Pwd=json.pwd;
                app.Syemp.EmpNo=json.empNo;
                app.Syemp.EmpNmae=json.empNmae;
            });
        }
    }
});
$("#bool").load("../ming.html");
</script>

</body> 
 
</html>